<template>
  <div class="page-content padding-top">
    <item class="y-item" style="margin-bottom: 10px;margin-top:10px">
      <span class="item-title">联系人</span>
      <input type="text" class="y-item-input" id="userName" name="" v-model="session.userName" placeholder="请填写联系人" required >
    </item>
    <item class="y-item" style="margin-bottom: 10px;margin-top:10px">
      <span class="item-title">手机号</span>
      <input type="text" class="y-item-input" name="" v-model="session.userMobile" placeholder="请填写手机号" required  disabled>
    </item>
    <item class="y-item" style="margin-bottom: 50px;margin-top:10px">
      <span class="item-title">公司名称</span>
      <input type="text" class="y-item-input" name="" v-model="session.marketName" placeholder="请填写公司名称" required  disabled>
    </item>
    <div class="outbtn" ><md-button class="button button-assertive button-block" @click.native="updateUser">确认</md-button></div>
    

  </div>
</template>
<script>
import { bus } from 'bus.js'
  export default {
    data() {
      return {
        session:sess.get('userSession')
      }
    },
    methods: {
      updateUser(){
        if (this.userName == '') {
          $toast.show('联系人不能为空',3000);
          return false;
        }
        var _this = this;
        axios.get(baseUrl+'/controller/updateUser',{params:{
            userId:sess.get('userSession').userId,
            userName:_this.session.userName,
          }
        })
        .then(function(res){
          setTimeout(()=>{
            $toast.show('联系人修改成功！',3000);
          },400);
          sess.set('userSession',_this.session)
          bus.$emit('userName',_this.session.userName);
        })
      }
    }
  }
</script>
